<% form_remote_tag(
    :url => { 
      :controller => "ratings",
      :action     => "new" },
    :bind => "this",
    :failure =>
      "Submit.updateErrors('Sorry, something went wrong.');",
    :success =>
      "Ratings.resetForm(this, true);",
    :complete => 
      "Submit.genericAfterSubmit(this);",
    :before => "if (!Submit.genericSubmit(this)) return false; if (!Ratings.validate(this)) { Submit.genericAfterSubmit(this); return false;}",
    :html => {
      :class => "default_enable" }
    ) do %>
  <%= hidden_field_tag "display_type_after_submit", @type.nil? ? 1 : 0, :id => nil %>
  <%= hidden_field_tag "guid", "", :id => nil, :class => "guid" %>
    
  <div class="spacer">
    <%= select(
          "rateable_object", 
          "rating", 
          ['Rating'] + (1..10).to_a.reverse, 
          {}, 
          { :id => nil,
            :class => "default rateable_rating", 
            :name => "rateable_rating" } ) %>
            
    <%= select(
          "rateable_object", 
          "type", 
          RateableObject::TYPES.collect { |t| [t.capitalize, t] }, 
          { :selected => @type }, 
          { :class => "default rateable_type", 
            :name => "type",
            :onchange => "Ratings.changeType(this); return false;"} ) %>
  </div>
  <div class="spacer">
    <%= text_field_tag(
          "name", 
          "Title", 
          :id => nil,
          :class => "default dormant rateable_name",
          :disabled => "disabled",
          :autocomplete => "off",
          :dormant_value  => "Title",
          :maxlength => "50") %>
  </div>
  <div class="spacer">
  <%= text_field_tag(
        "creator", 
        "Creator",
        :id => nil,
        :class => "default dormant rateable_creator ",
        :disabled => "disabled",
        :autocomplete => "off",
        :dormant_value  => "Creator",
        :maxlength => "50" ) %>
  </div>
  <div class="spacer">
  <%= text_field_tag(
        "url", 
        "Link (Optional)", 
        :id => nil,
        :class => "default dormant rateable_url",
        :disabled => "disabled",
        :autocomplete => "off",
        :dormant_value  => "Link (Optional)",
        :maxlength => "50" ) %>
  </div>
  
  <div class="spacer">
    <%= submit_tag "+", :class => "default submit" %>  
    <div class="loading" style="display: none;"><%= image_tag("loading.gif", :style => "padding: 2px 0px;") %></div>
    <br class="clear"/>
  </div>
  
  <div class="errors">
  </div>
<% end %>
